
*****APPENDIX TABLES AND FIGURES

****DESCRIPTIVE STATISTICS

cd "/Users/lauragarciamontoya/Dropbox/0 War and Participation/2022/REPLICATION FILES HARVARD DATAVERSE/"

***TABLE S1
use panel_short_rest_politicians_final, clear

keep if t<10

sum turnout_alc treatment_rest treatment_cand treatment_office any_kills ln_pop urban_rate any_att y_corr acc_subversivas if t!=.


use panel_full_final, clear

keep if t<10

sum turnout_alc treatment_all treatment_cand treatment_office any_kills ln_pop urban_rate any_att y_corr acc_subversivas if t!=.

******COVARIATE BALANCE CHECKS
***TABLE S3-S10

			
use "kill_panel_calendar_year.dta", clear

keep if year>=1993 & year<2005

collapse (sum) any_kills any_att, by(codemun)


save "violence_paracovbal_1993.dta", replace


use "kill_panel_calendar_year.dta", clear

keep if year>=2005 & year<2016

collapse (sum) any_kills any_att, by(codemun)

save "violence_paracovbal_2005.dta", replace



*1993
use "panel_datos_municipales.dta", clear
keep if year==1993  

merge 1:1 codemun using violence_paracovbal_1993

gen treatment_kill=0 if any_kills==0 & (any_att>=1 & any_att!=.)
replace treatment_kill=1 if (any_kills>=1 & any_kills!=.)

gen treatment_nonrestricted=0 if any_kills==0 | any_kills==.
replace treatment_nonrestricted=1 if (any_kills>=1 & any_kills!=.)

gen y_total_pc=y_total/population_total

*Table S3
covbal treatment_kill ln_pop indrural y_total_pc gini pobreza nbi ind_alfa1993 asistesc 

*Table S4
covbal treatment_nonrestricted ln_pop indrural y_total_pc gini pobreza nbi ind_alfa1993 asistesc 


*2005
use "panel_datos_municipales.dta", clear
keep if year==2005  


merge 1:1 codemun using violence_paracovbal_2005

gen treatment_kill=0 if any_kills==0 & (any_att>=1 & any_att!=.)
replace treatment_kill=1 if (any_kills>=1 & any_kills!=.)

gen treatment_nonrestricted=0 if any_kills==0 | any_kills==.
replace treatment_nonrestricted=1 if (any_kills>=1 & any_kills!=.)

gen y_total_pc=y_total/population_total

*Table S5
covbal treatment_kill ln_pop indrural y_total_pc gini pobreza nbi ind_alfa2005 asistesc coca  acc_subversivas 

*Table S6
covbal treatment_nonrestricted ln_pop indrural y_total_pc gini pobreza nbi ind_alfa2005 asistesc coca    acc_subversivas 

***DO NOT CHANGE OVERTIME
*Table S7
covbal treatment_kill discapital  disbogota areaoficialkm2 altura

*Table S8
covbal treatment_nonrestricted discapital  disbogota areaoficialkm2 altura

****Table S9
use panel_short_rest_politicians_final, clear
keep if t<10

covbal treatment_all turnout_alc ln_pop urban_rate y_corr acc_subversivas

****Table S10
use panel_full_final, clear
keep if t<10

covbal treatment_all turnout_alc ln_pop urban_rate y_corr acc_subversivas




**************ADDITIONAL ANALYSIS IN APPENDIX


****TABLE S11 - INTENSITY OF TREATMENT # OF VICTIMS	
use panel_short_rest_politicians_final, clear

gen interaction_rest=treatment_rest*any_kills
replace any_kills=0 if any_kills==.
replace interaction_rest=0 if interaction_rest==.

replace interaction_rest=. if treatment_rest==.

xtset codemun t

keep if t<10

*Bivariate 	(1)		
xtreg turnout_alc treatment_rest any_kills i.t, vce( cluster codemun)

* Bivariate + Election FE (2)
capture noisily xtreg turnout_alc treatment_rest any_kills i.t if (ln_pop!=. & urban_rate!=.), vce( cluster codemun)

* Bivariate + Election FE + DEPT (3)
capture noisily xtreg turnout_alc treatment_rest any_kills i.cod_dpto i.t, vce( cluster codemun)


* Bivariate + Election FE + DEPT + controls 1 (4)
capture noisily xtreg turnout_alc treatment_rest any_kills i.cod_dpto i.t ln_pop urban_rate, vce( cluster codemun)


* Bivariate + Election FE + DEPT + controls 2 (5)
capture noisily xtreg turnout_alc treatment_rest any_kills i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas, vce( cluster codemun)


*************************************
*****TABLE S12 **********************
*************************************

* Split sample into two time periods
use panel_short_rest_politicians_final, clear

**Elections between 1988 - 2003 
keep if t<=6

*Bivariate only (1)
xtreg turnout_alc treatment_rest if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 

*Bivariate + election effects (2)
xtreg turnout_alc treatment_rest i.t if (ln_pop!=. & 	urban_rate!=.), vce(cluster codemun) 

*Bivariate + Dept FE  (3)
xtreg turnout_alc treatment_rest i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)

* Dept FE  + controls 1 (4)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 

* Dept FE  + controls 2 (5)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 



**Elections between 2007 - 2015
use panel_short_rest_politicians_final, clear

keep if t>6 & t<10

*Bivariate only (6)
xtreg turnout_alc treatment_rest if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 


*Bivariate + election effects (7)
xtreg turnout_alc treatment_rest i.t if (ln_pop!=. & 	urban_rate!=.), vce(cluster codemun) 

*Bivariate + Dept FE Restricted (8)
xtreg turnout_alc treatment_rest i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)

* Dept FE Restricted  + controls 1 (9)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 

* Dept FE Restricted  + controls 2 (10)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 



*************************************
******************** TABLE S13 ******
*************************************


***DO ATTEMPTS HAVE AN EFFECT TOO?********

use panel_full_final, clear

sort year

keep if t<10

gen attempts=0 
replace attempts=1 if any_att>0 & any_att!=. & treatment_all==0
	
*Bivariate Only (1)
xtreg turnout_alc treatment_all attempts if (ln_pop!=. & urban_rate!=.),  cluster(codemun)
		

*Bivariate Only + TE (2)
xtreg turnout_alc treatment_all attempts i.t if (ln_pop!=. & urban_rate!=.),  cluster(codemun)
		
*Dept FE (3)
capture noisily xtreg turnout_alc treatment_all attempts i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 

*Dept FE + controls 1 (4)
capture noisily xtreg  turnout_alc treatment_all attempts ln_pop urban_rate i.cod_dpto i.t,  vce( cluster codemun) 


*Dept FE + controls 2 (5)
capture noisily xtreg  turnout_alc treatment_all attempts ln_pop urban_rate y_corr acc_subversivas i.cod_dpto i.t,  vce( cluster codemun) 
		
			
*Munic FE + controls (6)
capture noisily xtreg turnout_alc treatment_all attempts ln_pop urban_rate i.t y_corr acc_subversivas , fe  vce( cluster codemun) 


*Municipality-Time Trends (7)
reghdfe turnout_alc treatment_all attempts  if (ln_pop!=. & urban_rate!=.), absorb(codemun t c.t#i.codemun) vce( cluster codemun) 




*****ROBUSTNESS CHECKS 


*****************************
*********Table S14
*****************************

use panel_full_final, clear

xtset codemun t

keep if t<10

*Bivariate only (1)
xtreg turnout_alc treatment_all if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 

*Bivariate + election effects (2)
xtreg turnout_alc treatment_all i.t if (ln_pop!=. & 	urban_rate!=.), vce(cluster codemun) 

*Bivariate + Dept FE Restricted (3)
xtreg turnout_alc treatment_all i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)


* Dept FE Restricted  + controls(4)
xtreg turnout_alc treatment_all i.cod_dpto i.t ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


* Dept FE Restricted  + controls(5)
xtreg turnout_alc treatment_all i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 

reg turnout_alc treatment_all i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


*Munic FE + controls (6)
capture noisily xtreg turnout_alc treatment_all ln_pop urban_rate i.t y_corr acc_subversivas , fe  vce( cluster codemun) 


*Municipality-Time Trends (7)
reghdfe turnout_alc treatment_all   if (ln_pop!=. & urban_rate!=.), absorb(codemun t c.t#i.codemun) vce( cluster codemun) 


**********TABLE S15
use panel_short_rest_politicians_final, clear

xtset codemun t

*Bivariate only (1)
xtreg turnout_alc treatment_rest if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 

*Bivariate + election effects (2)
xtreg turnout_alc treatment_rest i.t if (ln_pop!=. & 	urban_rate!=.), vce(cluster codemun) 

*Bivariate + Dept FE Restricted (3)
xtreg turnout_alc treatment_rest i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)


* Dept FE Restricted  + controls(4)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


* Dept FE Restricted  + controls(5)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


************************
**** Figure S1

use panel_full_final, clear

*Prepares data for event studies
xtset codemun year

bysort codemun: egen tattempts=sum(any_att)
bysort codemun: egen tkills=sum(any_kills)

keep if (tkills!=. & tkills!=0) | (tattempts!=. & tattempts!=0)

keep if year<2019

gen year2=1 if year==1988
replace year2=2 if year==1990
replace year2=3 if year==1992
replace year2=4 if year==1994
replace year2=5 if year==1997
replace year2=6 if year==2000
replace year2=7 if year==2003
replace year2=8 if year==2007
replace year2=9 if year==2011
replace year2=10 if year==2015

drop if year2==.

xtset codemun year2

gen treatmentall_year = year2 if treatment_all==1
bysort codemun: egen first_treatedall=min(treatmentall_year)
drop treatmentall_year
gen ry_all=year2 - first_treatedall

 gen never_treated_all= (first_treatedall==.) 		

***loops to create time variable, drops using t-1 as baseline. 
forvalues k = 11(-1)2 {
           gen tall_`k' = ry_all == -`k'
		   label var tall_`k' "-`k'"
        }
		
        forvalues k = 0/11 {
             gen tall`k' = ry_all == `k'
			   label var tall`k' "+`k'"
        }
		
gen tall_1=0
label var tall_1 "-1"			


gen last_treated = (first_treatedall == 10)

drop if never_treated_all==1

eventstudyinteract turnout_alc tall_4 tall_3 tall_2 tall0 tall1 tall2 tall3 tall4 tall5 tall6, cohort(first_treatedall) control_cohort(last_treated) absorb(i.year2 i.codemun)

matrix C = e(b_iw)
mata st_matrix("A",sqrt(diagonal(st_matrix("e(V_iw)"))))
matrix C = C \ A' 
matrix list C

matrix new_C1 = (C[1,1] \ C[2,1])

matrix new_C2 = (C[1,2] \ C[2,2])

matrix new_C3 = (C[1,3] \ C[2,3])

matrix new_C4 = (0 \ 0 )

matrix new_C5 = (C[1,4] \ C[2,4])

matrix new_C6 = (C[1,5] \ C[2,5])

matrix new_C7 = (C[1,6] \ C[2,6])

matrix new_C8 = (C[1,7] \ C[2,7])

matrix new_C9 = (C[1,8] \ C[2,8])

matrix new_C10 = (C[1,9] \ C[2,9])

matrix new_C11 = (C[1,10] \ C[2,10])


matrix new_all = new_C1 , new_C2 , new_C3 , new_C4 , new_C5 , new_C6 , new_C7 , new_C8 , new_C9 , new_C10 , new_C11

matrix list new_all

matrix colnames new_all = tall_4 tall_3 tall_2 tall_1 tall0 tall1 tall2 tall3 tall4 tall5 tall6

matrix rownames new_all = r1 c1

coefplot matrix(new_all[1]), se(new_all[2]) vertical xline(4) bgcolor(white) graphregion(color(white))


*** Event study with Full sample
use panel_full_final, clear

xtset codemun year

bysort codemun: egen tattempts=sum(any_att)
bysort codemun: egen tkills=sum(any_kills)

keep if (tkills!=. & tkills!=0) | (tattempts!=. & tattempts!=0)

keep if year<2019

gen year2=1 if year==1988
replace year2=2 if year==1990
replace year2=3 if year==1992
replace year2=4 if year==1994
replace year2=5 if year==1997
replace year2=6 if year==2000
replace year2=7 if year==2003
replace year2=8 if year==2007
replace year2=9 if year==2011
replace year2=10 if year==2015


drop if year2==.

xtset codemun year2

gen treatmentall_year = year2 if treatment_all==1
bysort codemun: egen first_treatedall=min(treatmentall_year)
drop treatmentall_year
gen ry_all=year2 - first_treatedall

 gen never_treated_all= (first_treatedall==.) 		

***loops to create time variable, drops using t-1 as baseline. 
forvalues k = 11(-1)2 {
           gen tall_`k' = ry_all == -`k'
		   label var tall_`k' "-`k'"
        }
		
        forvalues k = 0/11 {
             gen tall`k' = ry_all == `k'
			   label var tall`k' "+`k'"
        }
		
			
gen tall_1=0
label var tall_1 "-1"	

drop if tkills>1

eventstudyinteract turnout_alc tall_4 tall_3 tall_2  tall0 tall1 tall2 tall3 tall4 tall5 tall6, cohort(first_treatedall) control_cohort(never_treated_all) absorb(i.year2 i.codemun) vce(cluster codemun) 

matrix C = e(b_iw)
mata st_matrix("A",sqrt(diagonal(st_matrix("e(V_iw)"))))
matrix C = C \ A' 
matrix list C
matrix new_C1 = (C[1,1] \ C[2,1])

matrix new_C2 = (C[1,2] \ C[2,2])

matrix new_C3 = (C[1,3] \ C[2,3])

matrix new_C4 = (0 \ 0 )

matrix new_C5 = (C[1,4] \ C[2,4])

matrix new_C6 = (C[1,5] \ C[2,5])

matrix new_C7 = (C[1,6] \ C[2,6])

matrix new_C8 = (C[1,7] \ C[2,7])

matrix new_C9 = (C[1,8] \ C[2,8])

matrix new_C10 = (C[1,9] \ C[2,9])

matrix new_C11 = (C[1,10] \ C[2,10])


matrix new_all = new_C1 , new_C2 , new_C3 , new_C4 , new_C5 , new_C6 , new_C7 , new_C8 , new_C9 , new_C10 , new_C11

matrix list new_all

matrix colnames new_all = tall_4 tall_3 tall_2 tall_1 tall0 tall1 tall2 tall3 tall4 tall5 tall6

matrix rownames new_all = r1 c1

coefplot matrix(new_all[1]), se(new_all[2]) vertical xline(4) bgcolor(white) graphregion(color(white))


gen last_treated = (first_treatedall == 10)

drop if never_treated_all==1
				
eventstudyinteract turnout_alc tall_4 tall_3 tall_2 tall0 tall1 tall2 tall3 tall4 tall5 tall6, cohort(first_treatedall) control_cohort(last_treated) absorb(i.year2 i.codemun) vce(cluster codemun)

matrix C = e(b_iw)
mata st_matrix("A",sqrt(diagonal(st_matrix("e(V_iw)"))))
matrix C = C \ A' 

matrix new_C1 = (C[1,1] \ C[2,1])

matrix new_C2 = (C[1,2] \ C[2,2])

matrix new_C3 = (C[1,3] \ C[2,3])

matrix new_C4 = (0 \ 0 )

matrix new_C5 = (C[1,4] \ C[2,4])

matrix new_C6 = (C[1,5] \ C[2,5])

matrix new_C7 = (C[1,6] \ C[2,6])

matrix new_C8 = (C[1,7] \ C[2,7])

matrix new_C9 = (C[1,8] \ C[2,8])

matrix new_C10 = (C[1,9] \ C[2,9])

matrix new_C11 = (C[1,10] \ C[2,10])


matrix new_all = new_C1 , new_C2 , new_C3 , new_C4 , new_C5 , new_C6 , new_C7 , new_C8 , new_C9 , new_C10 , new_C11

matrix list new_all

matrix colnames new_all = tall_4 tall_3 tall_2 tall_1 tall0 tall1 tall2 tall3 tall4 tall5 tall6

matrix rownames new_all = r1 c1

coefplot matrix(new_all[1]), se(new_all[2]) vertical xline(4) bgcolor(white) graphregion(color(white))


*******************
*********TABLE S15
*******************
		
use panel_short_rest_politicians_final, clear

xtset codemun t

*Bivariate only (1)
xtreg turnout_alc treatment_rest if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 

*Bivariate + election effects (2)
xtreg turnout_alc treatment_rest i.t if (ln_pop!=. & 	urban_rate!=.), vce(cluster codemun) 

*Bivariate + Dept FE Restricted (3)
xtreg turnout_alc treatment_rest i.cod_dpto i.t if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)

* Dept FE Restricted  + controls 1 (4)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 

* Dept FE Restricted  + controls 2 (5)
xtreg turnout_alc treatment_rest i.cod_dpto i.t ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 



******TABLE 4: EFFECTS IN POSTCONFLICT


*****2019 ELECTIONS
use "post_conflict_2019", clear

gen treatment_restricted_weighted=treatment_restricted*treatment_weight


*Bivariate Only (1)
reg turnout_alc treatment_restricted_weighted if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 


* Bivariate + Dept FE (2)
reg turnout_alc treatment_restricted_weighted i.cod_dpto if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 


* Dept FE Restricted  + controls 1 (3)
reg turnout_alc treatment_restricted_weighted i.cod_dpto ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


* Dept FE Restricted  + controls 2 (4)
reg turnout_alc treatment_restricted_weighted i.cod_dpto ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 


*****2023 ELECTIONS
use "post_conflict_2023", clear

gen treatment_restricted_weighted=treatment_restricted*treatment_weight



*Bivariate Only (1)
reg turnout_alc treatment_restricted_weighted if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 

* Bivariate + Dept FE (2)
reg turnout_alc treatment_restricted_weighted i.cod_dpto if (ln_pop!=. & urban_rate!=.), vce(cluster codemun) 


* Dept FE Restricted  + controls 1 (3)
reg turnout_alc treatment_restricted_weighted i.cod_dpto ln_pop urban_rate if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun)


* Dept FE Restricted  + controls 2 (4)
reg turnout_alc treatment_restricted_weighted i.cod_dpto ln_pop urban_rate y_corr acc_subversivas if (ln_pop!=. & urban_rate!=.),  vce( cluster codemun) 
